package co.com.smart.eagle.client.util.session;

import java.io.Serializable;

public class EagleSession implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private static EagleSession instance;
	static 
	{
		instance = new EagleSession();
	}

	public void invalidateSession()
	{
		EagleSession.instance = null;
		clearSession();
	}
	
	public static EagleSession getInstance()
	{
		return instance;
	}
	
	public void setUser(String user){
		setUserSession(user);
	}
	
	private native void clearSession()/*-{
		$wnd.localStorage.clear();
	}-*/;

	
	private  native void setUserSession(String user)/*-{
		$wnd.localStorage.setItem("userSession", user); ;
	}-*/;

	
}
